<?php


namespace app\api\model;


use app\api\model\msg\MsgModel;
use think\Model;

class UserMessageModel extends Model
{

    // 表名
    protected $name = 'user_message';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';

    // 定义时间戳字段名
    protected $createTime = 'create_time';
    protected $updateTime = false;

    protected $append = ['message_image'];

    public function getMessageImageAttr($val,$data)
    {

        $model = new MsgModel();
        $info = $model::get($data['message_id']);

        return $info['image'];
    }
}